package br.com.cept.sce.commons.util;

import java.util.Date;

import br.com.cept.sce.dao.LogDAO;
import br.com.cept.sce.dominio.impl.Log;
import br.com.cept.sce.exception.manterLog.LogException;

public class Logger {
	
	private static Logger instance;
	
	private Logger(){
		
	}
	
	public static Logger getInstance(){
		if(instance == null)
			instance = new Logger();
		return instance;
	}
	
	public void registrarLog(String mensagem, String usuarioId) throws LogException{
		Log log = new Log();
		log.setData(new Date());
		log.setIdUsuario(usuarioId);
		log.setOperacao(mensagem);
		LogDAO dao = new LogDAO();
		dao.salvarLog(log);
	}

}
